package com.freemyleft.left.left_app.mian.index.my.accept_setup;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.view.Menu;
import android.view.View;
import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.Toast;

import com.freemyleft.left.left_app.R;
import com.freemyleft.left.left_app.R2;
import com.freemyleft.left.zapp.delegates.LeftDelegate;

import butterknife.BindView;

/**
 * 授课距离显示
 */
public class TeachingDistanceDelegate extends LeftDelegate {
    @BindView(R2.id.seekBar)
    SeekBar seekBar;
    @BindView(R2.id.result)
    TextView result;

    @Override
    public Object setLayout() {
        return R.layout.delegate_grade_subject_distance;
    }

    @Override
    public void onBindView(@Nullable Bundle savedInstanceState, @NonNull View rootView) {
        initData();
    }

    private void initData() {

        seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
            /*
             * seekbar改变时的事件监听处理
             * */
            @Override
            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
                if (progress>99){
                    result.setText("同城不限距");
                }
                result.setText("当前进度：" + progress + "公里");

            }
            /*
             * 按住seekbar时的事件监听处理
             * */
            @Override
            public void onStartTrackingTouch(SeekBar seekBar) {
                Toast.makeText(getActivity(), "按住seekbar", Toast.LENGTH_SHORT).show();
            }
            /*
             * 放开seekbar时的时间监听处理
             * */
            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {
                Toast.makeText(getActivity(), "放开seekbar", Toast.LENGTH_SHORT).show();
            }
        });




}
}
